package com.leo.customer.entity.pojo

import com.leo.customer.entity.CreateTimeAndUpdateTime
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import javax.persistence.*
import javax.validation.constraints.NotBlank


@ApiModel
@Entity
data class Organize(
        @field:NotBlank(message = "组织名称不能为空")
        @ApiModelProperty("名称")
        var name: String = "",
        @ApiModelProperty("组织创建者", name = "组织创建者")
        @ManyToOne(targetEntity = User::class, cascade = [CascadeType.PERSIST, CascadeType.MERGE], fetch = FetchType.LAZY)
        @JoinColumn(name = "owner_id")
        var owner: User = User()

) : CreateTimeAndUpdateTime()


@Entity
data class OrganizeRole(
        var name: String = "",
        var code: Int = 0
) : CreateTimeAndUpdateTime()
